#include "pch.h"
#ifdef MODULES_SAVEFILELIMIT
BYTE m_SaveFileLimit_IsOn = FALSE;
DWORD m_SaveFileLimitFileSize = 0x6000;
DWORD m_SaveFileLimitFileSize_Old = 0x6000;
void m_SaveFileLimit_LoadCfg()
{
	m_SaveFileLimit_IsOn = cfgload::GetModuleCfgBool("Save File Limit", "Save File Limit IsOn");
	m_SaveFileLimitFileSize = cfgload::GetModuleCfgInt("Save File Limit", "Save File Limit File Size");
	m_SaveFileLimitFileSize_Old = cfgload::GetModuleCfgInt("Save File Limit", "Save File Limit File Size Old");
}

#define SAVEFILELIMITGO(X,Y) SaveFileLimitOffset = D2Game::GetAddress(X); \
									Memory::SetCursor(SaveFileLimitOffset); \
									Memory::ChangeDword(m_SaveFileLimitFileSize_Old+Y,m_SaveFileLimitFileSize+Y);
void m_SaveFileLimit_Install()
{
#ifdef D2SERVER
	DWORD SaveFileLimitOffset = 0;
	if (m_SaveFileLimit_IsOn)
	{
		SAVEFILELIMITGO(0x53F73, 0x000)
			SAVEFILELIMITGO(0x53887, 0x000)
			SAVEFILELIMITGO(0x538AB, 0x000)
			SAVEFILELIMITGO(0x538D1, 0x000)
			SAVEFILELIMITGO(0x538FF, 0x000)
			SAVEFILELIMITGO(0x5391D, 0x000)
			SAVEFILELIMITGO(0x562BD, 0x000)
			SAVEFILELIMITGO(0xCB0DE, 0x000)
			SAVEFILELIMITGO(0x53F73, 0x000)
			SAVEFILELIMITGO(0x53E82, 0x000)
			SAVEFILELIMITGO(0x54023, 0x000)
			SAVEFILELIMITGO(0x70FEE, 0x000)
			SAVEFILELIMITGO(0x71000, 0x000)
			SAVEFILELIMITGO(0x7167E, 0x000)
			SAVEFILELIMITGO(0x53F11, 0x5F8)
			SAVEFILELIMITGO(0x53F3C, 0x608)
			SAVEFILELIMITGO(0x53F5B, 0x620)
			SAVEFILELIMITGO(0x53F62, 0x61C)
			SAVEFILELIMITGO(0x53F6E, 0x60C)
			SAVEFILELIMITGO(0x53F7F, 0x610)
			SAVEFILELIMITGO(0x53FF4, 0x5F8)
			SAVEFILELIMITGO(0x537D1, 0x01C)
			SAVEFILELIMITGO(0x537DE, 0x02C)
			SAVEFILELIMITGO(0x537FC, 0x01C)
			SAVEFILELIMITGO(0x5383F, 0x01C)
			SAVEFILELIMITGO(0x538ED, 0x01C)
			SAVEFILELIMITGO(0x5396C, 0x038)
			SAVEFILELIMITGO(0x539C1, 0x03C)
			SAVEFILELIMITGO(0x53A34, 0x03C)
			SAVEFILELIMITGO(0x53A7D, 0x038)
			SAVEFILELIMITGO(0x53AB9, 0x038)
			SAVEFILELIMITGO(0x53AFC, 0x038)
			SAVEFILELIMITGO(0x53B38, 0x01C)
			SAVEFILELIMITGO(0x56251, 0x5F8)
			SAVEFILELIMITGO(0x5625D, 0x608)
			SAVEFILELIMITGO(0x56283, 0x614)
			SAVEFILELIMITGO(0x5630A, 0x5F8)
			SAVEFILELIMITGO(0x56319, 0x624)
			SAVEFILELIMITGO(0x56320, 0x620)
			SAVEFILELIMITGO(0x56327, 0x61C)
			SAVEFILELIMITGO(0x5632F, 0x614)
			SAVEFILELIMITGO(0x56337, 0x614)
			SAVEFILELIMITGO(0x56354, 0x624)
			SAVEFILELIMITGO(0x5635B, 0x620)
			SAVEFILELIMITGO(0x56362, 0x61C)
			SAVEFILELIMITGO(0x5636C, 0x61C)
			SAVEFILELIMITGO(0x56378, 0x61C)
			SAVEFILELIMITGO(0x5639C, 0x618)
			SAVEFILELIMITGO(0x563B1, 0x5F8)
			SAVEFILELIMITGO(0x53E51, 0x004)
			SAVEFILELIMITGO(0x53E7A, 0x014)
			SAVEFILELIMITGO(0x53E8E, 0x020)
			SAVEFILELIMITGO(0x53E9A, 0x020)
			SAVEFILELIMITGO(0x53F00, 0x004)
			SAVEFILELIMITGO(0x53FD7, 0x5F8)
			SAVEFILELIMITGO(0x0F781, 0x00C)
			SAVEFILELIMITGO(0x0F7F5, 0x034)
			SAVEFILELIMITGO(0x0F80A, 0x030)
			SAVEFILELIMITGO(0x0F811, 0x024)
			SAVEFILELIMITGO(0x0F818, 0x02C)
			SAVEFILELIMITGO(0x0F820, 0x02C)
			SAVEFILELIMITGO(0x0F831, 0x020)
			SAVEFILELIMITGO(0x0F88D, 0x024)
			SAVEFILELIMITGO(0x0F8DA, 0x00C)
			SAVEFILELIMITGO(0x0F8E9, 0x00C)
			SAVEFILELIMITGO(0x0F8F1, 0x008)
			SAVEFILELIMITGO(0x0F953, 0x028)
			SAVEFILELIMITGO(0x0F95A, 0x020)
			SAVEFILELIMITGO(0x0F962, 0x028)
			SAVEFILELIMITGO(0x0F973, 0x01C)
			SAVEFILELIMITGO(0x0F9CC, 0x020)
			SAVEFILELIMITGO(0x0FA1B, 0x008)
			SAVEFILELIMITGO(0x0FA29, 0x008)
			SAVEFILELIMITGO(0x0FA31, 0x008)
			SAVEFILELIMITGO(0x0FA93, 0x028)
			SAVEFILELIMITGO(0x0FA9A, 0x020)
			SAVEFILELIMITGO(0x0FAA2, 0x028)
			SAVEFILELIMITGO(0x0FAB3, 0x01C)
			SAVEFILELIMITGO(0x0FB0C, 0x020)
			SAVEFILELIMITGO(0x0FB5B, 0x008)
			SAVEFILELIMITGO(0x0FB69, 0x008)
			SAVEFILELIMITGO(0x54001, 0x038)
			SAVEFILELIMITGO(0x5401C, 0x054)
			SAVEFILELIMITGO(0x5402F, 0x054)
			SAVEFILELIMITGO(0x54051, 0x038)
			SAVEFILELIMITGO(0x54245, 0x054)
			SAVEFILELIMITGO(0x5424C, 0x050)
			SAVEFILELIMITGO(0x5401C, 0x054)
			SAVEFILELIMITGO(0x54254, 0x064)
			SAVEFILELIMITGO(0x5425D, 0x060)
			SAVEFILELIMITGO(0x5426C, 0x038)
			SAVEFILELIMITGO(0x54276, 0x060)
			SAVEFILELIMITGO(0x542C4, 0x058)
			SAVEFILELIMITGO(0x542CF, 0x054)
			SAVEFILELIMITGO(0x542D7, 0x054)
			SAVEFILELIMITGO(0x542EA, 0x070)
			SAVEFILELIMITGO(0x5430B, 0x038)
	}
#endif
}
void m_SaveFileLimit_UnInstall()
{

}

#endif
